<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间标题:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_title" data-rule="required" class="form-control" name="row[h_title]" type="text">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">副标题[属性]:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-h_attr" class="form-control " rows="5" name="row[h_attr]" placeholder="如：实拍 舒适 1居1床2人 换行 用'|' 分割，前端根据 '|' 换行 " cols="50"></textarea>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间编号:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="h_housebrand" data-rule="required" class="form-control" name="row[h_housebrand]" type="text">
        </div>
    </div>

    <div class="form-group">
        <label for="c-thumb" class="control-label col-xs-12 col-sm-2">房间图片:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-thumb" class="form-control"  name="row[h_imgs]" type="text" value="" />
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button" id="plupload-imagethumb" class="btn btn-danger plupload" data-input-id="c-thumb" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/webp" data-multiple="true" data-preview-id="p-thumb"><i class="fa fa-upload"></i>上传</button></span>
                    <span><button type="button" id="fachoose-imagethumb" class="btn btn-primary fachoose" data-input-id="c-thumb" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right"></span>
            </div>
            <ul class="row list-inline plupload-preview" id="p-thumb"></ul>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">选择酒店:</label>
        <div class="col-xs-12 col-sm-8">

            <select id="c-type" data-rule="required" class="form-control" name="row[h_id]" onchange="show_sub(this.options[this.options.selectedIndex].value)">
                {foreach name="hotelList" item="vo"}
                <option value="{$vo.hid}">{$vo.h_title}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">选择楼层[单元]:</label>
        <div class="col-xs-12 col-sm-8">

            <select id="c-h_storey" data-rule="required" class="form-control" name="row[h_storey]">
                {foreach name="hotelNumArr" item="vo"}
                <option value="{$vo}">{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">单价[时]:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_price" data-rule="required" class="form-control" step="0.01" name="row[h_price]" type="number" value="0.00">
        </div>
    </div>



    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间总价:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-h_allprice" data-rule="required" class="form-control" step="0.01" name="row[h_allprice]" type="number" value="0.00">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">房间设施:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="col-xs-12 col-sm-8">
                {foreach $serviceList as $key=>$vo}
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"   name="h_servs[]" checked value="{$vo.id}"> {$vo.name}
                </label>
                {/foreach}
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">基础设施:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="col-xs-12 col-sm-8">

                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]" checked value="1"> 无线网
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]" checked value="2"> 电梯
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]" checked value="3"> 落地窗
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service[]" checked value="4"> 空调
                </label>

            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">卫浴设施:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="col-xs-12 col-sm-8">

                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]" checked value="1"> 热水
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]" checked value="2"> 独立卫浴
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]" checked value="3"> 电吹风
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_service2[]" checked value="4"> 洗浴用品
                </label>

            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">入住须知:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="col-xs-12 col-sm-8">

                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="1"> 接待儿童
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="2"> 接待老人
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="3"> 接待外宾
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="4"> 带宠物
                </label>
                <br>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="5"> 吸烟
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="6"> 做饭
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="7"> 聚会
                </label>
                <label class="checkbox-inline checkbox" style="line-height: 24px;">
                    <input type="checkbox"  name="h_read[]" checked value="8"> 商拍
                </label>

            </div>
        </div>
    </div>


    <div class="form-group">
        <label for="c-editor" class="control-label col-xs-12 col-sm-2">房间详情:</label>

        <div class="col-xs-12 col-sm-8">
            <textarea name="row[h_content]" id="c-editor" cols="60" rows="5" class="form-control"></textarea>
        </div>

    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[h_status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
        </div>
    </div>

    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script>
    //下拉框切换
    function show_sub(v){
        $.ajax({
            type: "POST",
            url: "house/AjaxHotelNum",
            data: {hotelid:v},
            dataType: "json",
            success: function(data){
                if(data["msg"] == "error"){
                    $('#c-h_storey').empty();   //清空resText里面的所有内容
                    layer.alert("酒店楼层数据有误,请检查酒店参数");
                    return
                }else{
                    $('#c-h_storey').empty();   //清空resText里面的所有内容
                    var html = '';
                    $.each(data.data, function(commentIndex, comment){
                        html += '<option value="'+ comment +'">'+ comment +'</option>';
                    });
                    $('#c-h_storey').html(html);
                }





            }
        });
    }

</script>
